home *** CD-ROM | disk | FTP | other *** search
- /* This program is called to send a code to the IBM/Epson printer family
- * it sets unp printer for squeezed, emphasized, double width, double strike,
- * or normal print; it also sends carriage return and formfeed.
- * usage: PRTSET [-]{s b n c f e d}
- * s=squeeze e=emphasize d=double strike n=normal
- * b=double width c=<CR> f=<FORMFEED>
- * -option undoes option
- * c.1986 w.borys
- */
- #include "std.h"
-
- #define SQ "\017\0330"
- #define SOQ "\022\0332"
- #define BG "\033W\001"
- #define BOG "\033W\000"
- #define CR "\012\015"
- #define FF "\014"
- #define EM "\033E"
- #define EOM "\033F"
- #define DS "\033G"
- #define DOS "\033H"
-
- TEXT *pr[] = { SQ, SOQ, BG, BOG, EM, EOM, DS,DOS, CR, FF };
- COUNT nc[] = { 3,3,3,3,2,2,2,2,2,1 };
- main(ac,av)
- COUNT ac;
- TEXT *av[];
- {
- TEXT c;
- COUNT index, offset, iend, fd;
-
- c = toupper(av[1][0]);
- index = 99;
- offset = 0;
-
- if (c == '-')
- {
- offset = 1;
- c = toupper(av[1][1]);
- }
-
- switch ((COUNT) c)
- {
- case 'S':
- index = 0;
- break;
- case 'B':
- index = 2;
- break;
- case 'E':
- index = 4;
- break;
- case 'D':
- index = 6;
- break;
- case 'C':
- index = 8;
- break;
- case 'F':
- index = 9;
- break;
- case 'N':
- index = 10;
- break;
- }
-
- if (index == 99)
- {
- printf("usage: PRTSET {s b e d c f n} \n");
- printf("set up IBM printer from keyboard or batch file\n");
- printf("s=small e=emphasized d=double strike b=double width\n");
- printf(" n=normal -option undoes option \n");
- printf(" c=<CR> f=<FORMFEED> c1986 borysoft\n");
- exit(0);
- }
- else
- {
- index += offset;
- iend = index;
- if (index >= 10)
- index=1,iend=7;
- fd=open("PRN:", BWRITE);
- for (offset = index; offset <= iend; offset+=2)
- write(fd,pr[offset],nc[offset]);
- close(fd);
- }
- }
-